package com.bawei.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DelayedController {


    @Autowired
    private RabbitTemplate rabbitTemplate;

    @RequestMapping("/delayedMq")
    public void msg(){
        rabbitTemplate.convertAndSend("delayed.exchange","delayed.routingkey","你好",msg->{
            msg.getMessageProperties().setDelay(10000);
            return msg;
        });
    }
}
